package testaserviceprovider.service;

import com.hzh.api.dto.BDto;
import com.hzh.api.service.BService;
import com.hzh.service.AService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;

@DubboService
public class AServiceImpl implements AService {

    @DubboReference
    private BService bService;

    @Override
    public String getA() {
        return "I am the AService";
    }

    @Override
    public String getB() {
        BDto bDto = new BDto();
        bDto.setName("xxx AService->BService");
        return bService.testB(bDto);
    }

    @Override
    public String getEx() {
        try{
            return bService.testException();
        }catch (Exception e){
            return "捕抓成功： "+e.getMessage();
        }
    }
}
